<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function login(){
        $this -> display();
    }
    public function checkLogin(){
        $post = I('post.');
        $model = M('user');
        $data = $model ->where($post) -> find();
        if ($data){
            session('id',$data['id']);
            session('username',$data['user']);
            $this -> success('登录成功！',U('Index/index'),2);
        }
        else{
            $this -> error('用户名或密码错误!');
        }
    }
}